

from openpyxl import load_workbook


class exlsx():


    # 初始化
    def __init__(self,path,sheetname):
        self.path = load_workbook(path)
        self.sheetname = self.path[sheetname]


    def getdata(self):
        datalist = []
        for item in self.sheetname:
            list2 =[]
            list2.append(item[0].value)
            list2.append(item[1].value)
            datalist.append(list2)
        datalist.pop(0)
        return datalist
if __name__ == '__main__':
    path = r'D:\gao5_2210\lianxik\ui222\login.xlsx'
    sheetname = 'Sheet1'
    dy = exlsx(path,sheetname)
    print(dy.getdata())




